﻿using System;
using System.Linq;
using System.Linq.Expressions;
using SnippetBox.Core.Data.Models;

namespace SnippetBox.Core.Data.Repository {
    public interface IRepository<T> where T : class, IDeletable {
        IQueryable<T> GetAll();
        IQueryable<T> Where(Expression<Func<T, bool>> where);
        T SingleOrDefault(Expression<Func<T, bool>> where);
        T FirstOrDefault(Expression<Func<T, bool>> where);
        T GetById(int id);

        void Delete(T entity);
        void Add(T entity);
        void Attach(T entity);
        void SaveChanges();
    }
}
